package com.googlecode.flex_solder.util  {

  public class DateUtil {
    public static const SECOND:uint = 1000;
    public static const MINUTE:uint = 60 * DateUtil.SECOND;
    public static const HOUR:uint = 60 * DateUtil.MINUTE;
    public static const DAY:uint = 24 * DateUtil.HOUR;
    public static const WEEK:uint = 7 * DateUtil.DAY;

    public function DateUtil() {

    }

    public static
      function dateDiff(datePart:uint, date1:Date, date2:Date):uint {
      var dateDiffCalc:uint = 0;
      if (null != date1 && null != date2) {
	dateDiffCalc = (date1.time - date2.time) / datePart;
      }
      return dateDiffCalc;
    }

    public static function dateAdd(datePart:uint, increment:Number, 
				   date:Date):Date {
      var newDate:Date = null;

      if (null != date) {
	newDate = new Date(date.time);
	newDate.time += datePart * increment;
      }
      return newDate;
    }

  }
}